feat(class-variance): class-variance authority with slot support, and conflict-aware merging#2105
feat(class-variance): class-variance authority with slot support, and conflict-aware merging#2105iamdadmin wants to merge 8 commits into
Conversation
|
The failing test is a CI issue, it couldn't pull redis image so didn't complete. If someone could re-run just that single one that'd be great. |
|
I should add, I likely didn’t include everything a new package would need because I’m actually not sure what’s needed. I obviously don’t have GitHub permissions for setting up the split repo etc. I am happy to do the leg work on the parts I can do, with guidance on what’s needed! |
|
This pull request is stale because it has been open for 30 days with no activity. |
|
Sorry for the late reply, I've been busy 😬 TBH I'm not sure whether this should be a core package. I think it's a good candidate for a third party package (which I'm happy to endorse) |
|
I've closed for now, but feel free to continue the discussion here :) |
No worries, Enzo expressed interest so I popped it in to be given a review to prompt discussion and decision, so it having done that is fine. If you have any further thoughts on it and ultimately you think it adds value to the framework after all, but don’t want it to be a standalone package, I can refactor it into |
tempest/class-variance- a PHP package for building component CSS class strings with variants, compound variants, slot support, and conflict-aware merging. Heavily inspired by CVA and Tailwind-Variants, but with the ability to extend and support other CSS frameworks also.Two flavours:
cv()— separator-based merging, framework-agnostic CSS, somewhat limited by default but can be extended to support other frameworks.tv()— builds oncv()with Tailwind-aware merging, aiming to provide the same outcomes as tailwind-merge.Main features
slot,variants,compoundVariantsanddefaultVariants,tempest/discovery,Why this? / Notes
This is the biggest bit of work I've done; it's based on a fork I put together over here but attempting to fully adopt Tempest paradigms for integration.
Previously discussed with innocenzi in the discord about whether this would be welcome as a contrib ... so I hope you like it and I'm happy to work on any and all feedback and suggestions.
Acknowledgements / license
All code that went into this from my original fork was released under the MIT license (not much in the end, but it was a rough basis). CVA and Tailwind-Variants are both JS-sphere packages and no actual code was taken from these, not even as a pseudo-conversion to PHP. It's a ground-up implementation of similar syntax, which delivers similar outcomes, and is separate code entirely, however this package could not exist without their work, and the work of their inspirations. There's also an import from a MIT-licensed tailwind-merge package, with acknowledgements in the comments therein.
(If suited, I can put together a detailed ACKNOWLEDGEMENTS.md for this package specifically?)